package org.javason.jsonrpc.impl;

import org.apache.log4j.Logger;
import net.sf.json.JSONException;

import org.javason.jsonrpc.description.Param;

public class JsonRpcSystem {
	private static final Logger LOG = Logger.getLogger(JsonRpcSystem.class);
	public static final String VERSION = "$Rev$";
	
	private JsonRpcDescription _description = null;
	
	public JsonRpcSystem(JsonRpcService service) {
		_description = new JsonRpcDescription(service);
	}
	
	public String describe() {
		String result = "";
		try {
			result = _description.describe().toString(2);
		} catch (JSONException e) {
			LOG.error("error creating description", e);
		}
		return result;
	}
	
	public String echo(@Param(name="echo") String echo) {
		return echo;
	}
}
